package com.heima.user.feign;

import com.heima.client.user.IUserClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.user.service.ApUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 */
@RestController
@Slf4j
public class UserClient implements IUserClient {
    @Autowired
    private ApUserService apUserService;
    /**
     * 根据用户id查找用户粉丝
     *
     * @param userId,authorId
     * @return
     */
    @Override
    @GetMapping("/api/v1/user/query/{userId}/{authorId}")
    public ResponseResult isFan(@PathVariable Integer userId, @PathVariable Long authorId){
        log.info("根据用户：{}查找是否是：{}粉丝",userId,authorId);
        return apUserService.isFan(userId,authorId);
    }

    @GetMapping("/api/v1/user/query/{userId}")
    public ResponseResult queryUser(@PathVariable Integer userId){
        log.info("根据用户id查找用户信息:{}",userId);
        return apUserService.queryUser(userId);
    }
}
